package sctu.edu.java.year2016.team05.wangliwei.day20160530.chapter10_3;

import com.sun.javafx.collections.MappingChange;

import java.util.HashMap;
import java.util.Map;

/**
 * 创建Map集合，创建Emp对象，并将创建的Emp对象添加到集合中（Emp对象的id作为Map集合的键），并将id为005的对象从集合中移除
 */
public class Test {
    public static void main(String[] args) {
        Map<String,String>map=new HashMap<String,String>();
        Emp e1=new  Emp("001","赵");
        Emp e2=new Emp("002","钱");
        Emp e3=new Emp("003","孙");
        Emp e4=new Emp("004","李");
        Emp e5=new Emp("005","周");

        map.put(e1.getId(),e1.getName());
        map.put(e2.getId(),e2.getName());
        map.put(e3.getId(),e3.getName());
        map.put(e4.getId(),e4.getName());
        map.put(e5.getId(),e5.getName());

        System.out.println("原Map集合" + map);

        map.remove("005");

        System.out.println("去除005后的集合"+map);
    }
}



class Emp{
    private String id;
    private String name;
    public Emp(String id,String name){
        this.id=id;
        this.name=name;
    }

    public String getId() {
        return id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }
}